package com.phiture.erp.finance.dal.mapper;

import java.util.*;

import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
import com.phiture.erp.finance.dal.entity.ErpFinanceStatementDO;
import com.phiture.erp.finance.dal.entity.ErpFinanceStatementItemsDO;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

/**
 * 对账单 Mapper
 *
 * @author 芋道源码
 */
@Mapper
public interface ErpFinanceStatementMapper extends BaseMapperX<ErpFinanceStatementDO> {

//    default PageResult<ErpFinanceStatementDO> selectPage(ErpFinanceStatementPageReqVO reqVO) {
//        return selectPage(reqVO, new LambdaQueryWrapperX<ErpFinanceStatementDO>()
//                .eqIfPresent(ErpFinanceStatementDO::getNo, reqVO.getNo())
//                .eqIfPresent(ErpFinanceStatementDO::getType, reqVO.getType())
//                .eqIfPresent(ErpFinanceStatementDO::getBillingPeriod, reqVO.getBillingPeriod())
//                .betweenIfPresent(ErpFinanceStatementDO::getStatementDate, reqVO.getStatementDate())
//                .eqIfPresent(ErpFinanceStatementDO::getStatus, reqVO.getStatus())
//                .orderByDesc(ErpFinanceStatementDO::getId));
//    }

    List<ErpFinanceStatementDO> getPurchaseInByPeriod(
            @Param("billingPeriod")String billingPeriod,
            @Param("status")Integer status,
            @Param("type")Integer type, // 1: 采购入库对账单, 2: 销售出库对账单
            @Param("supplierId")Long supplierId,
            @Param("tenantId")Long tenantId,
            @Param("startDate")String startDate,
            @Param("endDate")String endDate);

    List<ErpFinanceStatementItemsDO> getPurchaseInItemsByPeriod(
            @Param("supplierId")Long supplierId,
            @Param("status")Integer status,
            @Param("tenantId")Long tenantId,
            @Param("startDate")String startDate,
            @Param("endDate")String endDate);

    List<ErpFinanceStatementDO> getPurchaseReturnByPeriod(
            @Param("billingPeriod")String billingPeriod,
            @Param("status")Integer status,
            @Param("type")Integer type, // 1: 采购入库对账单, 2: 销售出库对账单
            @Param("supplierId")Long supplierId,
            @Param("tenantId")Long tenantId,
            @Param("startDate")String startDate,
            @Param("endDate")String endDate);

    List<ErpFinanceStatementItemsDO> getPurchaseReturnItemsByPeriod(
            @Param("supplierId")Long supplierId,
            @Param("status")Integer status,
            @Param("tenantId")Long tenantId,
            @Param("startDate")String startDate,
            @Param("endDate")String endDate);

    int updatePurchaseInStatusByIds(
            @Param("ids") List<Long> ids,
            @Param("accountCheckFlag") Integer accountCheckFlag,
            @Param("tenantId") Long tenantId);

    int updatePurchaseReturnStatusByIds(
            @Param("ids") List<Long> ids,
            @Param("accountCheckFlag") Integer accountCheckFlag,
            @Param("tenantId") Long tenantId);

}